<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default4.aspx.vb" Inherits="Test_Default4" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <aspExt:ScriptManager ID="ScriptManager1" runat="server">
        </aspExt:ScriptManager>
    <div>
        <asp:TextBox ID="txt" runat="server"></asp:TextBox>
        <input type="button" id="btn" onclick="show();" />
    </div>
    </form> 
    
<script type="text/javascript">
    var goExit = false;
     window.onbeforeunload = function(event)
      {        
         if (event==null)  event= window.event;
         var key = event.keyCode || "0";
         var ex = event.clientX;
         var ey = event.clientY;
         if((ex>document.body.clientWidth&&ey<0||event.altKey) ||//{event.returnValue="In rigth or alt+F4, Are you sure you want to sign out proeprty web?";} 
            (ey>document.documentElement.offsetHeight)||//else if{ event.returnValue="In bottom, Are you sure you want to sign out proeprty web?";}
            (ey<0&&ey>-20)){//  else if{ event.returnValue="In Tab, Are you sure you want to sign out proeprty web?";}
                   goExit=true;
                   event.returnValue='Are you sure you want to close proeprty web?';
         }
         else{
         goExit=false;// event.returnValue="In Refersh, Are you sure you want to sign out proeprty web?";  
         }
      } 
    
      window.onunload=function(){
        if(goExit){
                    alert("will closeing.send request....");
                            
           var xmlhttp;
           if(window.ActiveXObject){
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }else if(window.XMLHttpRequest) {
                xmlhttp = new XMLHttpRequest();
            }
            xmlhttp.open("Get","../Handler/verification.ashx?mode=verificationcode&code=" + "111",false);  
            xmlhttp.send(null);
            var strResult = xmlhttp.responseText;
            alert(strResult);
        }
     } 

</script>
</body>
</html>
